package com.firewolf.rbac;

import java.util.Random;

/**
 * 作者：刘兴
 * 时间:19/2/22
 **/
public class Test {
    public static void main(String args[]) {

        System.out.println(renmibi(19100002.055));
    }

    public static String renmibi(double renminbi) {

        String[] units = new String[]{"分", "角", "元", "拾", "佰", "仟", "萬","拾萬","佰萬","仟萬"};

        String[] nums = new String[]{"零", "壹", "贰", "叁", "肆", "伍", "六", "七", "捌", "玖"};
        String result = "";
        int a = (int) (renminbi * 100);
        int unit = 0;
        while (a != 0) {
            int x = a % 10;
            a = a / 10;
            result = nums[x] + units[unit] + result;
            unit += 1;
        }


        return result;
    }


}
